/*
This file is part of AI Agent Feed.

"AI Agent Feed" is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

"AI Agent Feed" is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with "AI Agent Feed".  If not, see <http://www.gnu.org/licenses/>.
 */
package com.feed.domain;

import org.joda.time.DateTime;

public class FeedStatusCategory {

	private String siteName;
	private String categoryName;
	private int numItems;
	private DateTime latestItemTimestamp;
	private String notificationEmail;
	private boolean maxIntervalExceeded;
	
    @Override
    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + (categoryName == null ? 0 : categoryName.hashCode());
        result = PRIME * result + (siteName == null ? 0 : siteName.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (!(obj instanceof FeedStatusCategory)) return false;
        final FeedStatusCategory other = (FeedStatusCategory) obj;
        return categoryName.equals(other.categoryName) && siteName.equals(other.siteName);
    }
    
    public int compareTo(FeedStatusCategory other) {
        int result = siteName.compareTo(other.siteName);
        if (result == 0) {
            result = categoryName.compareTo(other.categoryName);
        }
        return result;
    }
    
    @Override
    public String toString() {
        StringBuilder buffy = new StringBuilder();
        buffy.append(getClass().getSimpleName()).append("[");
        buffy.append(siteName).append(",");
        buffy.append(categoryName).append(",");
        buffy.append(numItems).append(",");
        buffy.append(latestItemTimestamp);
        buffy.append("]");
        return buffy.toString();
    }

	
	public String getSiteName() {
		return siteName;
	}
	public void setSiteName(String siteName) {
		this.siteName = siteName;
	}
	public String getCategoryName() {
		return categoryName;
	}
	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}
	public int getNumItems() {
		return numItems;
	}
	public void setNumItems(int numItems) {
		this.numItems = numItems;
	}
	public DateTime getLatestItemTimestamp() {
		return latestItemTimestamp;
	}
	public void setLatestItemTimestamp(DateTime latestItemTimestamp) {
		this.latestItemTimestamp = latestItemTimestamp;
	}
	public String getNotificationEmail() {
		return notificationEmail;
	}
	public void setNotificationEmail(String notificationEmail) {
		this.notificationEmail = notificationEmail;
	}
	public void setMaxIntervalExceeded(boolean maxIntervalExceeded) {
		this.maxIntervalExceeded = maxIntervalExceeded;
    }

	public boolean isMaxIntervalExceeded() {
    	return maxIntervalExceeded;
    }
	
}
